package com.wg.wuge.tulin.jmm;

public class RunnableTest extends Thread{

//    public static void main(String[] args) {
////        Fixed
//    }
//
//    @Override
//    public void run() {
//        System.out.println("wuge test");
//
//    }
//    public static void main(String[] args) {
//        RunnableTest test = new RunnableTest();
//        test.run();
//    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(getName() + ":" + i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    public static void main(String[] args) throws InterruptedException {
        RunnableTest RunnableTest1 = new RunnableTest();
        RunnableTest RunnableTest2 = new RunnableTest();
        RunnableTest1.setName("张飞");
        RunnableTest2.setName("关羽");
        RunnableTest1.setDaemon(true);
        RunnableTest2.setDaemon(true);
        RunnableTest1.start();
        RunnableTest2.start();
        Thread.currentThread().setName("刘备");
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + "：" + i);
        }
    }
}
